package com.qingcloud.adminbackend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qingcloud.adminbackend.entity.source.DataSource;
import com.qingcloud.adminbackend.entity.source.DataSourceDatabaseDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author wangjinnan
 * @since 2021-03-17
 */
@Component
public interface DataSourceMapper extends BaseMapper<DataSource> {

    List<DataSource> findAll();

    List<DataSourceDatabaseDto> findAllDsDb();

    int addDatasource(DataSource dataSource);

    int deleteDatasourceByIds(@Param("ids") List<String> ids);

    int updateDatasource(DataSource dataSource);

    DataSource findDatasourceByNameOrId(@Param("dsId") String dsId, @Param("dsName") String dsName);

    List<DataSource> findDatasourceByIds(@Param("ids") List<String> ids);

    List<DataSource> findDatasourceByName(@Param("name") String name, @Param("projectId") String projectId);

    List<DataSource> findDatasourceByProjectId(@Param("projectId") String projectId);
}
